import 'package:flutter/material.dart';
import './search.dart';
import './form.dart';

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
        ElevatedButton(
            onPressed: () {
              // 基本路由的跳转
              Navigator.of(context)
                  .push(MaterialPageRoute(builder: (BuildContext context) {
                return const Search();
              }));
            },
            child: const Text('搜索')),
        const SizedBox(height: 20),
        ElevatedButton(
            onPressed: () {
              // 基本路由的跳转
              Navigator.of(context)
                  .push(MaterialPageRoute(builder: (BuildContext context) {
                return const FormPage(title: '标题111', aid: 12);
              }));
            },
            child: const Text('跳转传值'))
      ]),
    );
  }
}
